//
//  POImageTextFieldCell.m
//  Fontcase
//
//  Created by Pieter Omvlee on 5/31/08.
//  Copyright 2008 Bohemian Coding. All rights reserved.
//

#import "CHImageTextFieldCell.h"


@implementation CHImageTextFieldCell

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
  if (icon) {
    NSRect r = cellFrame;
    r.origin.x += 18;
    [super drawWithFrame:r inView:controlView];
    [icon setFlipped:YES];
    NSSize s = NSMakeSize(16,16);
    NSRect fromRect = NSMakeRect(0,0,[icon size].width,[icon size].height);
    NSRect inRect   = NSMakeRect(cellFrame.origin.x,cellFrame.origin.y + (cellFrame.size.height-s.height)/2,s.width,s.height);
    [icon drawInRect:inRect fromRect:fromRect operation:NSCompositeSourceOver fraction:1.0];
  } else
    [super drawWithFrame:cellFrame inView:controlView];
}

@synthesize icon;

@end
